﻿@model TGIApp.Model.User
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        @* <legend>Organizer</legend>*@
        <div class="editor-label">
            @Html.LabelFor(model => model.UserName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UserName)
            @Html.ValidationMessageFor(model => model.UserName)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Password)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Phone)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Phone)
            @Html.ValidationMessageFor(model => model.Phone)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Status)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Status)
            @Html.ValidationMessageFor(model => model.Status)
        </div>
        <!-- Put a hidden field to keep track of addressid otherwise when posting the form it will take User.Address.Id = 0 when object is created for Edit (post) -->
        @{ if (ViewContext.RouteData.Values["Action"].ToString().ToLower() == "edit")
           { 
            <div>
                @Html.HiddenFor(model => model.Address.Id)
            </div>
           }
        }
        <div class="editor-label">
            @Html.LabelFor(model => model.Address.Line1)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address.Line1)
            @Html.ValidationMessageFor(model => model.Address.Line1)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Address.Line2)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address.Line2)
            @Html.ValidationMessageFor(model => model.Address.Line2)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Address.City)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address.City)
            @Html.ValidationMessageFor(model => model.Address.City)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Address.State)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address.State)
            @Html.ValidationMessageFor(model => model.Address.State)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Address.Country)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address.Country)
            @Html.ValidationMessageFor(model => model.Address.Country)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Address.PostalCode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address.PostalCode)
            @Html.ValidationMessageFor(model => model.Address.PostalCode)
        </div>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}
